WO 2007/050012 discloses a visual detection arrangement in a milking system comprising a robot arm for attaching a teat cup to a teat of a milking animal, and a control device for controlling the movement of the robot arm. The detection arrangement comprises first visual detection means provided on the robot arm for repeatedly determining the teat position relative the robot arm and second visual detection means directed towards the milking animal.
The second visual detection means is provided for detecting the position of the animal in a longitudinal direction, and the control device is initially provided for controlling the movement of the robot arm based on information of the position of the teat of the animal relative the animal itself, and on the detected longitudinal position of the animal. The second visual detection means is preferably a two-dimensional camera, and is located beside the milking animal when being in the milking box, and essentially on a level with the teats of the milking animal, and directed essentially in a direction y which is orthogonal to the longitudinal direction x of the milking animal.